package com.jkoss.dao.kc;

import java.util.List;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.jkoss.pojo.kc.Kaoshi;
import com.jkoss.pojo.kc.KaoshiExample;

public interface KaoshiMapper {
     

	int countByExample(KaoshiExample example);

    int deleteByExample(KaoshiExample example);

    int deleteByPrimaryKey(Integer themeid);

    int insert(Kaoshi record);

    int insertSelective(Kaoshi record);

    List<Kaoshi> selectByExample(KaoshiExample example);

    Kaoshi selectByPrimaryKey(Integer themeid);

    int updateByExampleSelective(@Param("record") Kaoshi record, @Param("example") KaoshiExample example);

    int updateByExample(@Param("record") Kaoshi record, @Param("example") KaoshiExample example);

    int updateByPrimaryKeySelective(Kaoshi record);

    int updateByPrimaryKey(Kaoshi record);

    @Insert("insert into t_kaoshi( thename, themetime, sjurl, sjansurl,clzid,eid) values(#{kaoshi.thename},#{kaoshi.themetime},#{kaoshi.sjurl},#{kaoshi.sjansurl},#{kaoshi.clzid},#{kaoshi.eid})")
	void insertks(@Param("kaoshi") Kaoshi kaoshi);

    @Select("select b.clzname,a.* from t_kaoshi a,t_classes b where a.clzid=#{clzid} and a.clzid=b.clzid")
    @ResultMap("com.jkoss.dao.KaoshiMapper.BaseResultMap2")
	List<Kaoshi> selectKsByClzid(@Param("clzid") int clzid);
    //@Select("select a.*,b.clzname from t_kaoshi a,t_classes b where a.clzid=#{clzid} and a.clzid=b.clzid")

	@Update("UPDATE t_kaoshi set kaoshipj=#{ks.kaoshipj},ksdescb=#{ks.kaoshipj} where themeid=#{ks.themeid}")
    int upadateKspjBz(@Param("ks")Kaoshi ks);
	
	@Select("select a.thename ,a.themeid ,b.stuname from t_kaoshi a,(select * from t_ossstu where ossstuid=#{ossstuid}) b where a.clzid=b.clzid")
	@ResultMap("com.jkoss.dao.KaoshiMapper.BaseResultMap2")
	List<Kaoshi> selectKaoshiAndStuname(@Param("ossstuid")int ossstuid);
}